<?php

namespace App\Http\Models\Role;

use Illuminate\Database\Eloquent\Model;

class Role extends Model
{
    protected $table = "role";

    /**
     * 新增展示的字段
     * @var array
     */
    protected $fillable = [
        'role_name',
        'role_explain',
        'created_at',
        'updated_at'
    ];

    /**
     * 查询显示该字段
     * @var array
     */
    protected $hidden = [
        'id',
        'role_name',
        'role_explain',
        'created_at',
        'updated_at'
    ];

    public function getPermission()
    {
        return $this->belongsToMany('App\Http\Models\Permissions\Permissions', 'role_permissions', 'roleid', 'permissionsid');
    }
}
